#ifndef __ADC_H__
#define __ADC_H__

#include "gps.h"
#include "gsm.h"
#include "time.h"
#define adc_sample_freq 20000
#define adc_bufsize 25000
#define adc_maxindex 30
#define adc_buf_reserve 0

#define ADTriger_Data_Size 256
//#define adc_buf_datacntpos (adc_buf_reserve-5)

void  Adc_Init(void);
void AD_Triger_Handler(void);
u8 find_nearst_data(__checktime t);
typedef struct __attribute__((packed))
{
   vu8 adcdata[adc_maxindex][adc_bufsize];
   u16 adc_datacnt[adc_maxindex];
	 u16 cur_index;
   nmea_utc_time sample_timelabel[adc_maxindex];
//	 time_t UnixTimeLable[adc_maxindex];
}__ADC;


#define ADTriger_Fifo_Size 100

__packed typedef struct
{
	 u8  Triger_Flag;
   u16 Triger_Point[ADTriger_Fifo_Size];
	 u8  Triger_Index;
	 u8  Triger_SpanTime;
	 nmea_utc_time Triger_TimeLabel[ADTriger_Fifo_Size];
	 u8  data[ADTriger_Fifo_Size][ADTriger_Data_Size];
	 time_t UnixTimeLable[ADTriger_Fifo_Size];
}__ADTriger;
extern __ADC adc;
extern __ADTriger  ADTriger;
#endif

